<template>
	<cu-page-base :nav-bar-options="navBarOptions">
		<view class="cu-w-100 cu-px-20 cu-pt-20">
			<u-row justify="space-between" gutter="10">
				<u-col span="6">
					<view @click="gotoPage('/pages/voice/index/index','navigate')" class="cu-w-100 cu-shadow cu-border-r-20 cu-bg-main cu-mb-40 cu-p-20"
						style="height: 180rpx;">
						<view class="cu-row cu-j-start cu-a-center cu-px-10 cu-pt-10 cu-font-big cu-font-weight">
							<u--image shape="circle" :showLoading="true" src="/static/images/index/yphc.png" width="80rpx"
								height="80rpx"></u--image>
							<text class="cu-pl-10">语音合成</text>
						</view>
						<view class="cu-row cu-px-10 cu-j-center">
							配音神器
						</view>
					</view>
				</u-col>
			</u-row>
			
			<view class="cu-w-100">
				<uni-section class="mb-10" title="常见问题" type="line">
					<template v-slot:right>
						<view @click="gotoPage('/pages/oauth/account/problem/list','navigate')"><text style="border-bottom: 1px solid #3e3e7e;">更多</text><uni-icons type="forward" size="14"></uni-icons></view>
					</template>
					<view class="cu-w-100 cu-px-20 cu-d-flex cu-flex-column cu-a-stretch cu-j-sb">
						<block v-for="(item,idx) in problemStore.list">
							<block v-if="idx <= 4">
								<view :key="idx" @click="gotoPage('/pages/oauth/account/problem/problem?idx=' + idx,'navigate')" class="cu-w-100 cu-row cu-j-sb cu-ovr-hdn" :style="{
									lineHeight:'60rpx',
									borderBottom: idx === (problemStore.list.length - 1)  || idx === 4 ? undefined : '1px solid #CCCCCC;'
								}">
									<view>{{item.title}}?</view>
									<view><uni-icons type="forward" size="14"></uni-icons></view>
								</view>
							</block>
						</block>
					</view>
				</uni-section>
			</view>
		</view>
		<u-modal :show="showModal" @close="closeModal" @cancel="closeModal" @confirm="confirmModal" ref="uModal"
			:title="modal.title" :content='modal.content' :zoom="true" :showCancelButton="true"
			:closeOnClickOverlay="true"></u-modal>
	</cu-page-base>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import commMiXin from '@/common/mixin/common-mixin.js';
	export default {
		mixins: [commMiXin],
		computed: {
			...mapState({
				commonStore: state => state.commonStore,
				loginStore: state => state.loginStore,
				problemStore:state => state.problemStore,
			}),
		},
		data() {
			return {
				showModal: false,
				modelType: "",
				modal: {
					title: '温馨提示',
					content: '您尚未登录，是否前往登录？'
				},
				navBarOptions: {
					title: "首页",
				},
			};
		},
		onLoad() {
			if (this.loginStore.token_expire === true) {
				this.showModal = true;
				this.modelType = "login";
				content: '登录已过期，请重新登录'
			}
		},
		methods: {
			closeModal() {
				this.showModal = false;
				// console.log('close');
			},
			confirmModal() {
				if (this.modelType === "login") {
					this.gotoPage("/pages/oauth/loginbywx/loginbywx", "navigate");
				}

			},
			moreFun(){
				console.log("更多")
			}
		}
	}
</script>

<style lang="scss">
.uni-section-content{
	padding: 10px;
}

</style>